﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Sort
{
    static class lib
    {
        static public void Swap<T>(T[] arr, int i, int j)
        {
            T t = arr[i];
            arr[i] = arr[j];
            arr[j] = t;
        }

        static public void PutArr<T>(T[] arr)
        {
            foreach(T t in arr)
            {
                Console.Write("{0},", t);
            }
            Console.WriteLine("");
        }

        static public void print(this object o, string suffix = "")
        {
            Console.Write("{0}  " + suffix, o);
        }

        static public void printHeap<T>(T[] arr)
        {
            Console.SetCursorPosition(40, Console.CursorTop + 2);
            arr[0].print();

            Console.SetCursorPosition(20, Console.CursorTop + 2);
            arr[1].print();

            Console.SetCursorPosition(60, Console.CursorTop);
            arr[2].print();

            Console.SetCursorPosition(10, Console.CursorTop + 2);
            arr[3].print();

            Console.SetCursorPosition(30, Console.CursorTop);
            arr[4].print();

            Console.SetCursorPosition(50, Console.CursorTop);
            arr[5].print();

            Console.SetCursorPosition(70, Console.CursorTop);
            arr[6].print();

            Console.SetCursorPosition(5, Console.CursorTop + 2);
            arr[7].print();

            Console.SetCursorPosition(15, Console.CursorTop);
            arr[8].print();

            Console.SetCursorPosition(25, Console.CursorTop);
            arr[9].print();
        }
    }
}
